<template>
  <!--快速登机-->
  <div>
    <swiper :imgList="imgList"></swiper>
    <ul>
      <span v-html="config.thirdContent"></span>
    </ul>
    <!--<p class="offer" @click="goBuy">立即购买</p>-->
  </div>
</template>

<script type="text/ecmascript-6">
  import {getThirdCommonGoods} from '../../../test/unit/http'
  import {getStore} from '../../../test/unit/storage'
  import swiper from '../offertemplate/imgswipertemplate'

  export default {
    name: 'commongoods',
    props: {},
    data() {
      return {
        imgList: [],
        config: {}
      };
    },
    methods: {
      goBuy() {
        let token = getStore("token");
        if(token){
          this.$router.push({path: '/jinkadetail', query: {goodsId: this.config.goodsId}});
        }else{
          this.$router.push({path: '/register', query: {goodsId: this.config.goodsId}});
        }

      },
      getData(params) {
        let that = this;
        getThirdCommonGoods(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            that.config = res.object.thirdConfig;
            let configImg = that.config.thirdConfigImg;
            let isEmpty = that.$myUtils.isNull(configImg);
            if (!isEmpty) {
              that.imgList = configImg.split(",");
            }
            console.log(that.imgList)
          }
        })
      }
    },
    created() {
      this.getData({thirdConfigCode: "tongcheng"});
    },
    components: {
      swiper
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  ul {
    padding: 10px 10px 60px;
    text-align: left;
    margin-bottom: 50px;

    li:first-child {
      font-size: 20px;
      color: #111;
      font-weight: 700;
    }

    li:nth-child(2) {
      line-height: 25px;
      font-size: 15px;
      color: #666;
      margin: 10px 0;
    }
  }

  .offer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-image: linear-gradient(to right, #f9964e, #ff8551);
    height: 50px;
    line-height: 50px;
    color: #fff;
  }
</style>
